package com.example.service;

import com.example.entity.SysRoom;
import com.example.mapper.SysRoomMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*  的逻辑层
**/
@Service
@RequiredArgsConstructor
public class SysRoomService {

   private final SysRoomMapper sysRoomMapper;

   /**
   * 增
   **/
   public void add(SysRoom sysRoom) {
       sysRoomMapper.insert(sysRoom);
   }

   /**
   * 删
   **/
   public void deleteById(Integer id) {
       sysRoomMapper.deleteById(id);
   }

   /**
   * 批量删除
   **/
   public void deleteBatch(List<Integer> ids) {
       for (Integer id : ids) {
       sysRoomMapper.deleteById(id);
       }
   }

   /**
   * 改
   **/
   public void updateById(SysRoom sysRoom) {
       sysRoomMapper.updateById(sysRoom);
   }

   /**
   * 根据ID查询
   **/
   public SysRoom selectById(Integer id) {
       return sysRoomMapper.selectById(id);
   }

   /**
   * 查询所有
   **/
   public List<SysRoom> selectAll(SysRoom sysRoom) {
       return sysRoomMapper.selectAll(sysRoom);
   }

   /**
   * 分页查询
   **/
   public PageInfo<SysRoom> selectPage(SysRoom sysRoom, Integer pageNum, Integer pageSize) {
       PageHelper.startPage(pageNum, pageSize);
       List<SysRoom> list = sysRoomMapper.selectAll(sysRoom);
       return PageInfo.of(list);
   }

}